home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 33
/
Volume 33 - JOGO DISK .iso
/
Games
/
space_escape.swf
/
scripts
/
DefineSprite_58_game
/
frame_1
/
DoAction.as
Wrap
Text File
|
2007-01-15
|
4KB
|
106 lines
this.attachMovie("game_world","world",0);
this.attachMovie("game_ship","ship",1);
this.attachMovie("game_display","display",2);
this.ship._x = 300;
this.ship._y = 225;
active = true;
paused = false;
inactiveCount = 0;
thisFrameTime = getTimer();
lastFrameTime = getTimer();
this.onEnterFrame = function()
{
var _loc1_ = _root;
var _loc2_ = this;
thisFrameTime = getTimer();
_loc1_.timeSecs = (thisFrameTime - lastFrameTime) / 1000;
if(!Key.isToggled(20))
{
paused = false;
}
else
{
paused = true;
}
if(active == true)
{
if(paused == false)
{
shipHitAX = _loc2_.ship._x;
shipHitAY = _loc2_.ship._y;
shipHitBX = _loc2_.ship._x + 10 * Math.sin((_loc2_.ship._rotation + 90) * 0.017453292519943295);
shipHitBY = _loc2_.ship._y - 10 * Math.cos((_loc2_.ship._rotation + 90) * 0.017453292519943295);
shipHitCX = _loc2_.ship._x + 10 * Math.sin((_loc2_.ship._rotation - 90) * 0.017453292519943295);
shipHitCY = _loc2_.ship._y - 10 * Math.cos((_loc2_.ship._rotation - 90) * 0.017453292519943295);
if(_loc2_.world.shape.hitTest(shipHitAX,shipHitAY,true) || _loc2_.world.objects.hitTest(shipHitAX,shipHitAY,true) || _loc2_.world.shape.hitTest(shipHitBX,shipHitBY,true) || _loc2_.world.objects.hitTest(shipHitBX,shipHitBY,true) || _loc2_.world.shape.hitTest(shipHitCX,shipHitCY,true) || _loc2_.world.objects.hitTest(shipHitCX,shipHitCY,true))
{
active = false;
_loc2_.ship.active = false;
_loc2_.ship.attachMovie("game_ship_graphic#explosion","graphic",0);
if(_loc1_.soundOn == true)
{
_loc1_.effectsSound = new Sound();
_loc1_.effectsSound.attachSound("sound_explosion");
_loc1_.effectsSound.start(0,0);
}
}
if(_loc1_.game.world.startFinish.endPlate.hitTest(_loc1_.game.ship._x,_loc1_.game.ship._y,true))
{
active = false;
_loc2_.ship.active = false;
_loc2_.ship.attachMovie("game_ship_graphic#finish_" + _loc1_.shipType,"graphic",0);
if(_loc1_.soundOn == true)
{
_loc1_.effectsSound = new Sound();
_loc1_.effectsSound.attachSound("sound_fanfare");
_loc1_.effectsSound.start(0,0);
}
}
if(_loc1_.timeBonus > 0)
{
_loc1_.timeBonus -= _loc1_.timeSecs;
}
}
}
else
{
paused = false;
if(inactiveCount >= 60)
{
if(_loc1_.pTimeTrial == true)
{
if(_loc1_.game.world.startFinish.endPlate.hitTest(_loc1_.game.ship._x,_loc1_.game.ship._y,true))
{
_loc1_.gotoAndStop("trialCompleted");
removeMovieClip(_loc2_);
}
else
{
_loc1_.gotoAndStop("trialFailed");
removeMovieClip(_loc2_);
}
}
else if(_loc1_.game.world.startFinish.endPlate.hitTest(_loc1_.game.ship._x,_loc1_.game.ship._y,true))
{
_loc1_.gotoAndStop("levelCompleted");
removeMovieClip(_loc2_);
}
else if(_loc1_.lives > 0)
{
_loc1_.gotoAndStop("levelFailed");
removeMovieClip(_loc2_);
}
else
{
_loc1_.gotoAndStop("gameOver");
removeMovieClip(_loc2_);
}
}
else
{
inactiveCount++;
}
}
lastFrameTime = thisFrameTime;
};